<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>

    <title>用户信息</title>

    <link rel="shortcut icon" href="assets/img/logo2x.png"/>
    <!-- Bootstrap core CSS -->
    <link href="assets/css/bootstrap.css" rel="stylesheet"/>
    <!--external css-->
    <link rel="stylesheet" type="text/css" href="assets/font-awesome/css/font-awesome.css"/>
    <link rel="stylesheet" type="text/css" href="assets/css/zabuto_calendar.css">
    <link rel="stylesheet" type="text/css" href="assets/js/gritter/css/jquery.gritter.css"/>
    <link rel="stylesheet" type="text/css" href="assets/lineicons/style.css">

    <!-- Custom styles for this template -->
    <link href="assets/css/style.css" rel="stylesheet">
    <link href="assets/css/style-responsive.css" rel="stylesheet">

    <script src="assets/js/chart-master/Chart.js"></script>

    <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
    <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>

<body>

<section id="container">
    <div th:replace="tools :: header"></div>

    <div th:replace="tools :: sidebar "></div>


    <!-- **********************************************************************************************************************************************************
    MAIN CONTENT
    *********************************************************************************************************************************************************** -->
    <!--main content start-->
    <section id="main-content">
        <section class="wrapper site-min-height">
            <div class="form-panel">
                <div class="btn-group">
                    <button class="btn " onclick="window.history.back()"><i class="fa fa-angle-left"></i> 返回</button>
                    <button class="btn " onclick="javascript:location.reload();"><i class="fa fa-refresh"></i> 刷新
                    </button>
                </div>
            </div>
            <div class="row">
                <div class="col-lg-12">
                    <div class="col-md-12 mb">

                        <div class="white-panel pn">
                            <div class="white-header">
                                <h3 class=""><i class="fa fa-angle-right"></i> 用户信息 <i class="fa fa-angle-left"></i>
                                </h3>
                            </div>
                            <div class="centered"><img th:src="${viewuser.picurl}" class="img-circle" width="80"></div>
                            <div><b th:text="${viewuser.username}"></b></div>
                            <div class="row col-xs-12">
                                <div class="col-md-4 col-xs-4">
                                    <p class="small mt">性别</p>
                                    <p th:text="${viewuser.gender}"></p>
                                </div>
                                <div class="col-md-4 col-xs-4">
                                    <p class="small mt">年龄</p>
                                    <p th:value="${viewuser.age}"></p>
                                </div>
                                <div class="col-md-4 col-xs-4">
                                    <p class="small mt">生日</p>
                                    <p th:value="${viewuser.birthday}"></p>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="panel col-md-12">
                        <h4 class="text-primary"><i class="fa fa-angle-right"></i>基本信息</h4>
                        <form id="infoform">
                            <div class="form-group">
                                <div class="row left">
                                    <div class="col-md-6">
                                        <label class="h4">用户ID: </label>
                                        <input type="text" class="h4 form-control" id="userid"
                                               th:value="${viewuser.infoid}"
                                               name="infoid"
                                               readonly="readonly">
                                    </div>
                                    <div class="col-md-6">
                                        <label class="h4">邮箱: </label>
                                        <input type="text" class="h4 form-control" th:value="${viewuser.email}"
                                               name="email"
                                               readonly="readonly">
                                    </div>
                                    <div class="col-md-6">
                                        <label class="h4">注册时间 :</label>
                                        <input type="text" class="h4 form-control" th:value="${viewuser.regtime}"
                                               name="regtime"
                                               readonly="readonly">
                                    </div>
                                    <div class="col-md-6">
                                        <label class="h4">真实姓名: </label>
                                        <input type="text" class="h4 form-control" th:value="${viewuser.realname}"
                                               name="realname"
                                               contenteditable="false">
                                    </div>
                                    <div class="col-md-6">
                                        <label class="h4">角色 :</label>
                                        <input type="text" class="h4 form-control" th:value="${viewuser.role.rolename}"
                                               readonly="readonly">
                                    </div>
                                    <div class="col-md-6">
                                        <label class="h4">用户名: </label>
                                        <input type="text" class="h4 form-control" th:value="${viewuser.username}"
                                               name="username">
                                    </div>

                                    <div class="col-md-6">
                                        <label class="h4">证件类型 :</label>
                                        <select class="h4 form-control" th:value="${viewuser.idtype}" name="idtype">
                                            <option value="A">身份证</option>
                                            <option value="B">护照</option>
                                            <option value="C">军人证</option>
                                        </select>
                                    </div>
                                    <div class="col-md-6">
                                        <label class="h4">证件号 :</label>
                                        <input type="text" class="h4 form-control" th:value="${viewuser.idcard}"
                                               name="idcard">
                                    </div>
                                    <div class="col-md-6">
                                        <label class="h4">年龄 :</label>
                                        <input type="text" class="h4 form-control" th:value="${viewuser.age}"
                                               name="age">
                                    </div>
                                    <div class="col-md-6">
                                        <label class="h4">生日 :</label>
                                        <input type="date" class="h4 form-control" id="birthday"
                                               th:value="${viewuser.birthday}" name="birthday">
                                    </div>
                                    <div class="col-md-6">
                                        <button class="btn btn-success udinfo" type="button">更新用户基本信息</button>
                                    </div>

                                </div>

                            </div>
                        </form>
                        <hr>
                        <h4 class="text-primary"><i class="fa fa-angle-right"></i>更新密码</h4>
                        <div class="col-md-6">
                            <input type="password" id="npassword" class="form-control" placeholder="请输入新密码">
                        </div>
                        <div class="col-md-6">
                            <input type="password" id="npasswordc" class="form-control" placeholder="请确认新密码">
                        </div>
                        <div class="col-md-6">
                            <br>
                            <button class="btn btn-success udpwd" type="button">更新密码</button>
                        </div>
                        <div class="col-md-12">
                            <hr>
                        </div>
                    </div>
                </div>
            </div>

        </section>
        <! --/wrapper -->

    </section>

    <!--main content end-->

    <!--**********************************************************************************************
    Footer
    **********************************************************************************************-->

    <!--footer start-->
    <footer class="site-footer">
        <div class="text-center">
            Copyright © 2018 David Bai
            <a href="#main-content" class="go-top">
                <i class="fa fa-angle-up"></i>
            </a>
        </div>
    </footer>
    <!--footer end-->
</section>


<!-- js placed at the end of the document so the pages load faster -->
<script src="assets/js/jquery.js"></script>
<script src="assets/js/jquery-1.8.3.min.js"></script>
<script src="assets/js/bootstrap.min.js"></script>
<script class="include" type="text/javascript" src="assets/js/jquery.dcjqaccordion.2.7.js"></script>
<script src="assets/js/jquery.scrollTo.min.js"></script>
<script src="assets/js/jquery.nicescroll.js" type="text/javascript"></script>
<script src="assets/js/jquery.sparkline.js"></script>

<!--common script for all pages-->
<script src="assets/js/common-scripts.js"></script>
<script>
    $(".udinfo").click(function () {
        $.post("/uduserinfo", $("#infoform").serialize(), function (data) {
            alert(data.message);
            location.reload();
        });
    });

    $(".udpwd").click(function () {
        var userid = $("#userid").val();
        var pwd = $("#npassword").val();
        var pwdc = $("#npasswordc").val();
        $.post("/uduserpwd", {userid: userid, pwd: pwd, pwdc: pwdc}, function (data) {
            alert(data.message);
            location.reload();
        });
    });
</script>


</body>
</html>
